'''
@File    :   shang.py
@Version : 1.0
@Author :   iherr
@Desciption : 计算熵
'''

import trees

def createDataSet():
    dataSet = [[1, 1, 'yes'],
               [1, 1, 'yes'],
               [1, 0, 'no'],
               [0, 1, 'no'],
               [0, 1, 'no']]
    labels = ['no surfacing', 'flippers']
    # change to discrete values
    return dataSet, labels

if __name__ == '__main__':
    dataSet,label=createDataSet()
    # shannonEnt=trees.calcShannonEnt(dataSet)
    # print(shannonEnt)

    # best=trees.chooseBestFeatureToSplit(dataSet)
    # print(best)

    myTree=trees.createTree(dataSet,label)
    print(myTree)